
extends "cutscene.gd"

var bullet = preload("res://scenes/bullet.tscn")

func _ready():
	super._ready()
	set_physics_process(false)
	if (controller.checkpoint == 1):
		hide()
	else:
		show()
	text = ["[Sora]: That was close, I was able to set \n up a shield for you before you went in.",
			"[Sora]: It'll only withstand a single attack, \nbut it'll regenerate over time.", 
			"[Sora]: Please remember this!"]
	check = "TutorialLifeforce"

func _physics_process(delta):
	if (!controller.cutscene):
		camera()
		set_physics_process(false)

func begin_cutscene():
	controller.cam_target = self
	get_node("Timer").start()
	set_physics_process(true)

func shoot():
	get_node("Position2D").add_child(bullet.instantiate())

func camera():
	get_node("AnimationPlayer").play("teleport")
	controller.cam_target = controller.player

func _on_Timer_timeout():
	var anim = get_node("AnimationPlayer")
	anim.play("shoot")
	anim.queue("idle")
